<template>
	<view class="mx-buy-button">
		<view class="price-bar">
			<image class="img-bag" src="/static/imgs/shopping-bag.png"></image>
			<text>合计：</text>
			<text>￥{{total}}</text>
		</view>
		<view class="buy-btn" @tap="onTap">
			<image src="/static/imgs/buy-btn.png"></image>
			<view class="btn-text">
				<view class="text-title">{{title}}</view>
				<image class="btn-img" src="/static/imgs/buy-btn-arrow.png"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"MxBuyButton",
		props: {
			title: {
				type: String,
				default: '立即购买'
			},
			
			total: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			onTap() {
				this.$emit('buy', this.total)
			}
		}
	}
</script>

<style scoped lang="scss">
@import '@/common/scss/common.scss';
.mx-buy-button{
	width: 632rpx;
	height: 104rpx;
	display: flex;
	align-items: center;
	position: relative;
	
	.price-bar{
		background-color: #fff;
		box-sizing: border-box;
		padding: 20rpx 16rpx;
		width: 100%;
		box-shadow: 0 0 2px 0 rgba($color: #000000, $alpha: .16);
		border-radius: 5px;
		display: flex;
		align-items: center;
		.img-bag{
			width: 44rpx;
			height: 50rpx;
			margin-right: 48rpx;
		}
		
		&>text:nth-child(2) {
			font-size: 16px;
			font-weight: bold;
			color: $color-primary;
		}
		
		&>text:nth-child(3) {
			font-size: 18px;
			font-weight: bold;
			color: $color-amount;
		}
	}
	
	.buy-btn{
		position: absolute;
		top: 0;
		right: 0;
		&>image{
			width: 248rpx;
			height: 104rpx;
		}
		
		.btn-text{
			display: inline-flex;
			justify-content: center;
			align-items: center;
			width: 220rpx;
			height: 104rpx;
			position: absolute;
			top: 0;
			right: 0;
			.btn-img {
				margin-left: 12rpx;
				width: 12rpx;
				height: 24rpx;
				position: relative;
				top: 1px;
			}
			
			.text-title{
				color: #fff;
				font-size: 16px;
				line-height: 16px;
				display: flex;
				align-items: center;
			}
			
			
		}
	}
}
</style>
